<!DOCTYPE html>
<!-- saved from url=(0096)http://stackoverflow.com/questions/13107535/using-asynchronous-post-requests-with-pythons-bottle -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        
    <title>ajax - Using asynchronous POST requests with Python's Bottle? - Stack Overflow</title>
    <link rel="shortcut icon" href="http://cdn.sstatic.net/stackoverflow/img/favicon.ico">
    <link rel="apple-touch-icon image_src" href="http://cdn.sstatic.net/stackoverflow/img/apple-touch-icon.png">
    <link rel="search" type="application/opensearchdescription+xml" title="Stack Overflow" href="http://stackoverflow.com/opensearch.xml">
    
    <script type="text/javascript" async="" src="./ajax - Using asynchronous POST requests with Python's Bottle  - Stack Overflow_files/adzerk1_2_4_43,adzerk2_2_17_45"></script><script type="text/javascript" async="" src="./ajax - Using asynchronous POST requests with Python's Bottle  - Stack Overflow_files/ga.js"></script><script type="text/javascript" async="" src="./ajax - Using asynchronous POST requests with Python's Bottle  - Stack Overflow_files/quant.js"></script><script type="text/javascript" src="./ajax - Using asynchronous POST requests with Python's Bottle  - Stack Overflow_files/jquery.min.js"></script>
    <script type="text/javascript" src="./ajax - Using asynchronous POST requests with Python's Bottle  - Stack Overflow_files/stub.js"></script>
    <link rel="stylesheet" type="text/css" href="./ajax - Using asynchronous POST requests with Python's Bottle  - Stack Overflow_files/all.css">
    
    <link rel="canonical" href="./ajax - Using asynchronous POST requests with Python's Bottle  - Stack Overflow_files/ajax - Using asynchronous POST requests with Python's Bottle  - Stack Overflow.html">
    <link rel="alternate" type="application/atom+xml" title="Feed for question &#39;Using asynchronous POST requests with Python&#39;s Bottle?&#39;" href="http://stackoverflow.com/feeds/question/13107535">
    <script type="text/javascript">
        
        StackExchange.ready(function () {
            StackExchange.using("postValidation", function () {
                StackExchange.postValidation.initOnBlurAndSubmit($('#post-form'), 2, 'answer');
            });

            
            StackExchange.question.init({showAnswerHelp:true,totalCommentCount:3,shownCommentCount:3,highlightColor:'#F4A83D',backgroundColor:'#FFF',questionId:13107535});

            styleCode();

                StackExchange.realtime.subscribeToQuestion('1', '13107535');
            
                
        });
    </script>


    <script type="text/javascript">
        StackExchange.init({"stackAuthUrl":"https://stackauth.com","serverTime":1372563714,"styleCode":true,"enableUserHovercards":true,"site":{"name":"Stack Overflow","description":"Q&A for professional and enthusiast programmers","isNoticesTabEnabled":true,"recaptchaPublicKey":"6LdchgIAAAAAAJwGpIzRQSOFaO0pU6s44Xt8aTwc","enableSocialMediaInSharePopup":true},"user":{"fkey":"2d0aec7595cc73e90ef39640b48e41c2","isAnonymous":true}});
        StackExchange.using.setCacheBreakers({"js/prettify-full.js":"6c261bebf56a","js/moderator.js":"82e0bdb93733","js/full-anon.js":"761e0ff892e6","js/full.js":"96302e0b9d3d","js/wmd.js":"2f79c03846d5","js/third-party/jquery.autocomplete.min.js":"e5f01e97f7c3","js/mobile.js":"e8e23ad37820","js/help.js":"6e6623243cf6","js/tageditor.js":"450c9e8426fc","js/tageditornew.js":"b6c68ad4c7dd","js/inline-tag-editing.js":"8e84e8a137f7","js/revisions.js":"7273bb714bba","js/review.js":"aa4e9e92f60d","js/tagsuggestions.js":"aa48ef6154df","js/post-validation.js":"bb996020492a","js/explore-qlist.js":"1c5bbd79b562"});
        
    </script>
    <script type="text/javascript">
        StackExchange.using("gps", function() {
             StackExchange.gps.init(true);
        });
    </script>
    
        <script type="text/javascript">
            StackExchange.ready(function () {
                $('#nav-tour').click(function () {
                    StackExchange.using("gps", function() {
                        StackExchange.gps.track("aboutpage.click", { aboutclick_location: "headermain" }, true);
                    });
                });
            });
        </script>
<script async="" type="text/javascript" src="./ajax - Using asynchronous POST requests with Python's Bottle  - Stack Overflow_files/full-anon.js"></script><script async="" type="text/javascript" src="./ajax - Using asynchronous POST requests with Python's Bottle  - Stack Overflow_files/post-validation.js"></script><script async="" type="text/javascript" src="./ajax - Using asynchronous POST requests with Python's Bottle  - Stack Overflow_files/prettify-full.js"></script><script type="text/javascript" src="./ajax - Using asynchronous POST requests with Python's Bottle  - Stack Overflow_files/adFeedback.js"></script><link rel="stylesheet" href="http://static.adzerk.net/Extensions/adFeedback.css"><link href="./ajax - Using asynchronous POST requests with Python's Bottle  - Stack Overflow_files/sidebar.min.css" type="text/css" rel="stylesheet"></head>
<body class="question-page" style="">
    <noscript>&lt;div id="noscript-padding"&gt;&lt;/div&gt;</noscript>
    <div id="notify-container"></div>
    <div id="overlay-header"></div>
    <div id="custom-header"></div>

    <div class="container">
        <div id="header" class="headeranon">
            <div id="portalLink">
                <a class="genu" onclick="StackExchange.ready(function(){genuwine.click();});return false;">Stack Exchange</a>
            </div>
            <div id="topbar">
                <div id="hlinks">
                    
<span id="hlinks-user"></span>
<span id="hlinks-nav">                        <a href="http://stackoverflow.com/users/login?returnurl=%2fquestions%2f13107535%2fusing-asynchronous-post-requests-with-pythons-bottle">sign up</a>

 <span class="lsep">|</span>
                    <a href="http://stackoverflow.com/users/login?returnurl=%2fquestions%2f13107535%2fusing-asynchronous-post-requests-with-pythons-bottle">log in</a>

 <span class="lsep">|</span>
                    <a href="http://careers.stackoverflow.com/">careers 2.0</a>

 <span class="lsep">|</span>
</span>
<span id="hlinks-custom"></span>
                </div>
                <div id="hsearch">
                    <form id="search" action="http://stackoverflow.com/search" method="get" autocomplete="off">
                        <div>
                            <input autocomplete="off" name="q" class="textbox" placeholder="search" tabindex="1" type="text" maxlength="240" size="28" value="">
                        </div>
                    </form>
                </div>
            </div>
            <br class="cbt">
            <div id="hlogo">
                <a href="http://stackoverflow.com/">
                    Stack Overflow
                </a>
            </div>
            <div id="hmenus">
                <div class="nav mainnavs mainnavsanon">
                    <ul>
                            <li class="youarehere"><a id="nav-questions" href="http://stackoverflow.com/questions">Questions</a></li>
                            <li><a id="nav-tags" href="http://stackoverflow.com/tags">Tags</a></li>
                            <li><a id="nav-tour" href="http://stackoverflow.com/about">Tour</a></li>
                            <li><a id="nav-users" href="http://stackoverflow.com/users">Users</a></li>
                    </ul>
                </div>
                <div class="nav askquestion">
                    <ul>
                        <li>
                            <a id="nav-askquestion" href="http://stackoverflow.com/questions/ask">Ask Question</a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        



        <div id="content">
            

<div itemscope="" itemtype="http://schema.org/Article">
<link itemprop="image" href="http://cdn.sstatic.net/stackoverflow/img/apple-touch-icon.png">
<!--googleoff: snippet-->
<div id="herobox-mini">
    <div id="hero-content">
        <span id="controls">
            <a href="http://stackoverflow.com/about" id="tell-me-more" class="button">Tell me more</a>
            <span id="close"><a title="click to dismiss">×</a></span>
        </span>
        <div id="blurb">
            <span id="site-name">Stack Overflow</span> is a question and answer site for 
            professional and enthusiast programmers. It's 100% free, no registration required.
        </div>        
    </div>
    <script>
        $('#tell-me-more').click(function () {
            var clickSource = $("body").attr("class") + '-mini';
            if ($("body").hasClass("questions-page")) {
                clickSource = 'questionpagemini';
            }
            if ($("body").hasClass("home-page")) {
                clickSource = 'homepagemini';
            }

            StackExchange.using("gps", function () {
                StackExchange.gps.track("aboutpage.click", { aboutclick_location: clickSource } , true);
            });
        });
        $('#herobox-mini #close').click(function () {
            StackExchange.using("gps", function () {
                StackExchange.gps.track("hero.action", { hero_action_type: "close" }, true);
            });
            $.cookie("hero", "none", { path: "/" });
            var $hero = $("#herobox-mini");
            $hero.slideUp('fast', function () { $hero.remove(); });
            return false;
        });
    </script>
</div>
<!--googleon: snippet-->
<div id="question-header">
    <h1 itemprop="name"><a href="./ajax - Using asynchronous POST requests with Python's Bottle  - Stack Overflow_files/ajax - Using asynchronous POST requests with Python's Bottle  - Stack Overflow.html" class="question-hyperlink">Using asynchronous POST requests with Python's Bottle?</a></h1>
</div>
<div id="mainbar">



<div class="question" data-questionid="13107535" id="question">
    
                <div class="everyonelovesstackoverflow adzerk-vote" id="adzerk1"><a href="http://engine.adzerk.net/r?e=eyJhdiI6NDcxLCJhdCI6NCwiY20iOjI5ODkxLCJjaCI6MTE3OCwiY3IiOjEwMDQ2LCJkaSI6IjI2NGFhMDgxM2I1MjQ2NmZhMzE5YjNhZmRkMzI5ZjA5IiwiZG0iOjEsImZjIjoxMDAxOTAsImZsIjo0OTY5MSwia3ciOiJweXRob24sYWpheCxwb3N0LGFzeW5jaHJvbm91cyxib3R0bGUiLCJudyI6MjIsInJmIjoiaHR0cHM6Ly93d3cuZ29vZ2xlLmNvbS5oay8iLCJydiI6MCwicHIiOjE1NjcsInN0Ijo4Mjc3LCJ6biI6NDMsInVyIjoiaHR0cDovL3d3dy5uc29mdHdhcmUuY29tLz9zbzEyIn0&s=z-Hi-wLtWNReSjiCtXZyU9Z6A4o" rel="nofollow" target="_blank" title=""><img src="./ajax - Using asynchronous POST requests with Python's Bottle  - Stack Overflow_files/f4a8d1f3f34d44f8ae3604feb2f777b5.png" title="" alt="" border="0" width="728" height="90"></a><div class="adzerk-vote-controls" style="display: none;"><div class="adzerk-vote-option adzerk-vote-up"><div class="adzerk-vote-icon"></div></div><div class="adzerk-vote-option adzerk-vote-down"><div class="adzerk-vote-icon"></div></div></div><div class="adzerk-vote-survey" style="display:none;"><form><span>No problem. We won't show you that ad again. Why didn't you like it?</span><ul><li><label><input type="radio" value="12" name="downvoteReason">Uninteresting</label></li><li><label><input type="radio" value="13" name="downvoteReason">Misleading</label></li><li><label><input type="radio" value="14" name="downvoteReason">Offensive</label></li><li><label><input type="radio" value="15" name="downvoteReason">Repetitive</label></li></ul><a href="http://stackoverflow.com/questions/13107535/using-asynchronous-post-requests-with-pythons-bottle#" class="adzerk-vote-cancel">Oops! I didn't mean to do this.</a></form></div><img height="0px" width="0px" border="0" src="./ajax - Using asynchronous POST requests with Python's Bottle  - Stack Overflow_files/i.gif"></div>


    <table>
        <tbody><tr>
            <td class="votecell">
                

<div class="vote">
    <input type="hidden" value="13107535">
    <a class="vote-up-off" title="This question shows research effort; it is useful and clear">up vote</a>
    <span class="vote-count-post ">1</span>
    <a class="vote-down-off" title="This question does not show any research effort; it is unclear or not useful">down vote</a>
    
    <a class="star-off" href="http://stackoverflow.com/questions/13107535/using-asynchronous-post-requests-with-pythons-bottle#" title="This is a favorite question (click again to undo)">favorite</a>
    <div class="favoritecount"><b>1</b></div>   

</div>

            </td>
            
<td class="postcell">
<div>
    <div class="post-text" itemprop="description">
        <p>I'm trying to create a turn-based strategy game (think Dominion) in Python. The core game objects and methods are Python classes with methods in them (just typical OO stuff). The UI is an HTML client using Bottle. I'm aiming for an entirely asynchronous approach. So the sole page's content is generated from the Python objects, and I want submits from the page to update those objects without ever leaving the page by going back through the bottle webserver (using jQuery AJAX for this).</p>

<p>At the moment I'm working on a basic chat system that retrieves player-written messages and stores them as Chat objects (containing player and text data, nothing else). These objects are then written to a chat window using AJAX that updates the windows once every second. The HTML format of the chat lines is <code>&lt;div class="chatLine"&gt;&lt;p&gt;Player &gt; &lt;/p&gt;&lt;p&gt;Text&lt;/p&gt;&lt;/div&gt;</code> Pretty standard stuff.</p>

<p>This basic diagram might make it a little clearer, even though it isn't really technical, more conceptual:</p>

<hr>

<h2><img src="./ajax - Using asynchronous POST requests with Python's Bottle  - Stack Overflow_files/oIPFQ.jpg" alt="Communication cycle diagram"></h2>

<hr>

<p>My BottleUI.py (this is what I run to start the server):</p>

<pre class="default prettyprint prettyprinted" style=""><code><span class="kwd">from</span><span class="pln"> </span><span class="typ">Populate</span><span class="pln"> </span><span class="kwd">import</span><span class="pln"> </span><span class="pun">*</span><span class="pln">  </span><span class="com"># Everything in Populate can now be directly called.</span><span class="pln">
</span><span class="com"># NOTE: Populate allows access to "bottle" and "Main"</span><span class="pln">

</span><span class="com"># This ensures the css file is available</span><span class="pln">
</span><span class="lit">@route</span><span class="pun">(</span><span class="str">'/theCSS'</span><span class="pun">)</span><span class="pln">
</span><span class="kwd">def</span><span class="pln"> </span><span class="kwd">static</span><span class="pun">():</span><span class="pln">
    </span><span class="kwd">return</span><span class="pln"> static_file</span><span class="pun">(</span><span class="str">'main.css'</span><span class="pun">,</span><span class="pln"> root</span><span class="pun">=</span><span class="str">'static'</span><span class="pun">)</span><span class="pln">

</span><span class="lit">@route</span><span class="pun">(</span><span class="str">'/citadel/:game/:player'</span><span class="pun">)</span><span class="pln">
</span><span class="kwd">def</span><span class="pln"> gamePage</span><span class="pun">(</span><span class="pln">game</span><span class="pun">,</span><span class="pln"> player</span><span class="pun">):</span><span class="pln">
    </span><span class="kwd">if</span><span class="pln"> </span><span class="kwd">not</span><span class="pln"> </span><span class="pun">(</span><span class="pln">game</span><span class="pun">.</span><span class="pln">isdigit</span><span class="pun">())</span><span class="pln"> </span><span class="kwd">or</span><span class="pln"> </span><span class="kwd">not</span><span class="pln"> </span><span class="pun">(</span><span class="pln">player</span><span class="pun">.</span><span class="pln">isdigit</span><span class="pun">()):</span><span class="pln">
        </span><span class="kwd">return</span><span class="pln"> </span><span class="str">"Invalid page."</span><span class="pln">
    game </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">int</span><span class="pun">(</span><span class="pln">game</span><span class="pun">)</span><span class="pln">
    player </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">int</span><span class="pun">(</span><span class="pln">player</span><span class="pun">)</span><span class="pln">
    </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">((</span><span class="pln">game </span><span class="pun">&gt;=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">)</span><span class="pln"> </span><span class="kwd">and</span><span class="pln"> </span><span class="pun">(</span><span class="pln">game </span><span class="pun">&lt;</span><span class="pln"> listOfGames</span><span class="pun">.</span><span class="pln">__len__</span><span class="pun">()))</span><span class="pln"> </span><span class="kwd">and</span><span class="pln"> </span><span class="pun">((</span><span class="pln">player </span><span class="pun">&gt;=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">)</span><span class="pln"> </span><span class="kwd">and</span><span class="pln"> </span><span class="pun">(</span><span class="pln">player </span><span class="pun">&lt;</span><span class="pln"> listOfGames</span><span class="pun">[</span><span class="pln">game</span><span class="pun">].</span><span class="pln">listOfPlayers</span><span class="pun">.</span><span class="pln">__len__</span><span class="pun">())):</span><span class="pln">

        </span><span class="kwd">return</span><span class="pln"> </span><span class="str">'''

&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;link rel="stylesheet" type="text/css" href="/theCSS"&gt;
    &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"&gt;&lt;/script&gt;
    &lt;!-- Sample AJAX script below, change as needed --&gt;
    &lt;script type="text/javascript"&gt;
        $(document).ready(function() {
            $('</span><span class="com">#chatForm').submit(function(e) {</span><span class="pln">
                $</span><span class="pun">.</span><span class="pln">ajax</span><span class="pun">({</span><span class="pln">
                    type</span><span class="pun">:</span><span class="pln"> </span><span class="str">'POST'</span><span class="pun">,</span><span class="pln">
                    url</span><span class="pun">:</span><span class="pln"> </span><span class="str">"/AddToChat/''' + str(game) + '''/''' + str(player) + '''"</span><span class="pun">,</span><span class="pln">
                    success</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
                        $</span><span class="pun">(</span><span class="str">'#chatInput'</span><span class="pun">).</span><span class="pln">val</span><span class="pun">(</span><span class="str">""</span><span class="pun">);</span><span class="pln">
                    </span><span class="pun">}</span><span class="pln">
                </span><span class="pun">});</span><span class="pln">
                e</span><span class="pun">.</span><span class="pln">preventDefault</span><span class="pun">();</span><span class="pln">
            </span><span class="pun">});</span><span class="pln">
        </span><span class="pun">});</span><span class="pln">
        setInterval</span><span class="pun">(</span><span class="str">"updateChat();"</span><span class="pun">,</span><span class="pln"> </span><span class="lit">1000</span><span class="pun">);</span><span class="pln">
        $</span><span class="pun">(</span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
            updateChat </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
                $</span><span class="pun">(</span><span class="str">'#chatText'</span><span class="pun">).</span><span class="pln">load</span><span class="pun">(</span><span class="str">'/GenerateChat/'''</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> str</span><span class="pun">(</span><span class="pln">game</span><span class="pun">)</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="str">''''</span><span class="pun">);</span><span class="pln">
            </span><span class="pun">};</span><span class="pln">
        </span><span class="pun">});</span><span class="pln">
    </span><span class="pun">&lt;/</span><span class="pln">script</span><span class="pun">&gt;</span><span class="pln">
    </span><span class="pun">&lt;!--</span><span class="pln"> </span><span class="typ">Script</span><span class="pln"> to scroll to bottom of divs </span><span class="pun">-</span><span class="pln"> needs to be changed </span><span class="kwd">into</span><span class="pln"> called </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">--&gt;</span><span class="pln">
    </span><span class="pun">&lt;</span><span class="pln">script type</span><span class="pun">=</span><span class="str">"text/javascript"</span><span class="pun">&gt;</span><span class="pln">
        window</span><span class="pun">.</span><span class="pln">onload </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
             </span><span class="kwd">var</span><span class="pln"> objDiv </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class="pln">getElementById</span><span class="pun">(</span><span class="str">"gameFlow"</span><span class="pun">);</span><span class="pln">
             objDiv</span><span class="pun">.</span><span class="pln">scrollTop </span><span class="pun">=</span><span class="pln"> objDiv</span><span class="pun">.</span><span class="pln">scrollHeight</span><span class="pun">;</span><span class="pln">
             objDiv </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class="pln">getElementById</span><span class="pun">(</span><span class="str">"chatText"</span><span class="pun">);</span><span class="pln">
             objDiv</span><span class="pun">.</span><span class="pln">scrollTop </span><span class="pun">=</span><span class="pln"> objDiv</span><span class="pun">.</span><span class="pln">scrollHeight</span><span class="pun">;</span><span class="pln">
        </span><span class="pun">};</span><span class="pln">
    </span><span class="pun">&lt;/</span><span class="pln">script</span><span class="pun">&gt;</span><span class="pln">
</span><span class="pun">&lt;/</span><span class="pln">head</span><span class="pun">&gt;</span><span class="pln">
</span><span class="str">&lt;body&gt;</span><span class="pln">
    </span><span class="pun">&lt;</span><span class="pln">div id</span><span class="pun">=</span><span class="str">"container"</span><span class="pun">&gt;</span><span class="pln">
        </span><span class="pun">&lt;!--</span><span class="pln"> </span><span class="typ">Make</span><span class="pln"> </span><span class="kwd">this</span><span class="pln"> have background</span><span class="pun">-</span><span class="pln">image </span><span class="kwd">with</span><span class="pln"> the game number displaying programmatically </span><span class="pun">--&gt;</span><span class="pln">
        </span><span class="pun">&lt;</span><span class="pln">div id</span><span class="pun">=</span><span class="str">"banner"</span><span class="pun">&gt;</span><span class="pln">
            </span><span class="str">&lt;h1&gt;</span><span class="typ">Citadel</span><span class="pln"> </span><span class="pun">-</span><span class="pln"> </span><span class="typ">Game</span><span class="pln"> </span><span class="str">''' + str(game) + '''</span><span class="pun">,</span><span class="pln"> </span><span class="typ">Player</span><span class="pln"> </span><span class="str">''' + str(player) + '''</span><span class="pun">&lt;/</span><span class="pln">h1</span><span class="pun">&gt;</span><span class="pln">
        </span><span class="pun">&lt;/</span><span class="pln">div</span><span class="pun">&gt;</span><span class="pln">
        </span><span class="pun">&lt;</span><span class="pln">div id</span><span class="pun">=</span><span class="str">"main"</span><span class="pun">&gt;</span><span class="pln">
            </span><span class="pun">&lt;</span><span class="pln">div id</span><span class="pun">=</span><span class="str">"leftPanel"</span><span class="pun">&gt;</span><span class="pln">
                </span><span class="pun">&lt;</span><span class="pln">div id</span><span class="pun">=</span><span class="str">"playerTotals"</span><span class="pun">&gt;</span><span class="pln">
                    </span><span class="str">&lt;h4&gt;</span><span class="typ">Player</span><span class="pln"> </span><span class="typ">Totals</span><span class="pun">:&lt;/</span><span class="pln">h4</span><span class="pun">&gt;</span><span class="pln">
                    </span><span class="pun">&lt;</span><span class="pln">div id</span><span class="pun">=</span><span class="str">"totalsText"</span><span class="pun">&gt;</span><span class="pln">
                        </span><span class="str">&lt;p&gt;</span><span class="typ">Money</span><span class="pun">:&lt;/</span><span class="pln">p</span><span class="pun">&gt;</span><span class="pln">
                        </span><span class="str">&lt;p&gt;</span><span class="typ">Population</span><span class="pun">:&lt;/</span><span class="pln">p</span><span class="pun">&gt;</span><span class="pln">
                        </span><span class="str">&lt;p&gt;</span><span class="typ">Troops</span><span class="pun">:&lt;/</span><span class="pln">p</span><span class="pun">&gt;</span><span class="pln">
                        </span><span class="str">&lt;p&gt;</span><span class="typ">Friend</span><span class="pun">:&lt;/</span><span class="pln">p</span><span class="pun">&gt;</span><span class="pln">
                        </span><span class="str">&lt;p&gt;</span><span class="typ">Enemy</span><span class="pun">:&lt;/</span><span class="pln">p</span><span class="pun">&gt;</span><span class="pln">
                    </span><span class="pun">&lt;/</span><span class="pln">div</span><span class="pun">&gt;</span><span class="pln">
                    </span><span class="pun">&lt;!--</span><span class="pln"> </span><span class="typ">Player</span><span class="pln"> totals go here </span><span class="pun">(</span><span class="pln">money</span><span class="pun">,</span><span class="pln"> population</span><span class="pun">/</span><span class="pln">limit</span><span class="pun">,</span><span class="pln"> troops</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">friend</span><span class="pun">,</span><span class="pln"> enemy</span><span class="pun">)</span><span class="pln"> </span><span class="pun">--&gt;</span><span class="pln">
                    </span><span class="pun">&lt;</span><span class="pln">div id</span><span class="pun">=</span><span class="str">"totalsNums"</span><span class="pun">&gt;</span><span class="pln">

                    </span><span class="pun">&lt;/</span><span class="pln">div</span><span class="pun">&gt;</span><span class="pln">
                    </span><span class="pun">&lt;</span><span class="pln">div </span><span class="kwd">class</span><span class="pun">=</span><span class="str">"clear"</span><span class="pun">&gt;&lt;/</span><span class="pln">div</span><span class="pun">&gt;</span><span class="pln">
                </span><span class="pun">&lt;/</span><span class="pln">div</span><span class="pun">&gt;</span><span class="pln">
                </span><span class="pun">&lt;</span><span class="pln">div </span><span class="kwd">class</span><span class="pun">=</span><span class="str">"leftSegment"</span><span class="pun">&gt;</span><span class="pln">
                    </span><span class="str">&lt;h4&gt;</span><span class="typ">Troop</span><span class="pln"> </span><span class="typ">Cards</span><span class="pun">:&lt;/</span><span class="pln">h4</span><span class="pun">&gt;</span><span class="pln">
                    </span><span class="pun">&lt;!--</span><span class="pln"> </span><span class="typ">Player</span><span class="str">'s troopCards here --&gt;
                    &lt;select size=2&gt;

                    &lt;/select&gt;
                &lt;/div&gt;
                &lt;div class="leftSegment"&gt;
                    &lt;h4&gt;Territory Cards:&lt;/h4&gt;
                    &lt;!-- Player'</span><span class="pln">s territoryCards here </span><span class="pun">--&gt;</span><span class="pln">
                    </span><span class="pun">&lt;</span><span class="kwd">select</span><span class="pln"> size</span><span class="pun">=</span><span class="lit">2</span><span class="pun">&gt;</span><span class="pln">

                    </span><span class="pun">&lt;/</span><span class="kwd">select</span><span class="pun">&gt;</span><span class="pln">
                </span><span class="pun">&lt;/</span><span class="pln">div</span><span class="pun">&gt;</span><span class="pln">
                </span><span class="pun">&lt;</span><span class="pln">div </span><span class="kwd">class</span><span class="pun">=</span><span class="str">"leftSegment"</span><span class="pun">&gt;</span><span class="pln">
                    </span><span class="str">&lt;h4&gt;</span><span class="typ">Region</span><span class="pln"> </span><span class="typ">Cards</span><span class="pun">:&lt;/</span><span class="pln">h4</span><span class="pun">&gt;</span><span class="pln">
                    </span><span class="pun">&lt;!--</span><span class="pln"> </span><span class="typ">Player</span><span class="str">'s regionCards here --&gt;
                    &lt;select size=2&gt;

                    &lt;/select&gt;
                &lt;/div&gt;
                &lt;div class="leftSegment"&gt;
                    &lt;h4&gt;Resource Cards:&lt;/h4&gt;
                    &lt;!-- Player'</span><span class="pln">s resourceCards here </span><span class="pun">--&gt;</span><span class="pln">
                    </span><span class="pun">&lt;</span><span class="kwd">select</span><span class="pln"> size</span><span class="pun">=</span><span class="lit">2</span><span class="pun">&gt;</span><span class="pln">

                    </span><span class="pun">&lt;/</span><span class="kwd">select</span><span class="pun">&gt;</span><span class="pln">
                </span><span class="pun">&lt;/</span><span class="pln">div</span><span class="pun">&gt;</span><span class="pln">
                </span><span class="pun">&lt;</span><span class="pln">div </span><span class="kwd">class</span><span class="pun">=</span><span class="str">"leftSegment"</span><span class="pun">&gt;</span><span class="pln">
                    </span><span class="str">&lt;h4&gt;</span><span class="typ">Diplomacy</span><span class="pln"> </span><span class="typ">Cards</span><span class="pun">:&lt;/</span><span class="pln">h4</span><span class="pun">&gt;</span><span class="pln">
                    </span><span class="pun">&lt;!--</span><span class="pln"> </span><span class="typ">Player</span><span class="str">'s diplomacyCards here --&gt;
                    &lt;select size=2&gt;

                    &lt;/select&gt;
                &lt;/div&gt;
                &lt;div id="chatPane"&gt;
                    &lt;form id="chatForm" method="POST" action="/AddToChat/'''</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> str</span><span class="pun">(</span><span class="pln">game</span><span class="pun">)</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="str">'''/'''</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> str</span><span class="pun">(</span><span class="pln">player</span><span class="pun">)</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="str">'''"&gt;
                        &lt;textarea name="theChatText" id="chatInput"&gt;&lt;/textarea&gt;
                        &lt;input id="chatSubmit" class="button" type="submit" value="Send" /&gt;
                    &lt;/form&gt;
                &lt;/div&gt;
                &lt;div class="clear"&gt;&lt;/div&gt;
            &lt;/div&gt;
            &lt;div id="rightPanel"&gt;
                &lt;!-- Game flow goes here (shows current player/phase, attacks with results, etc) --&gt;
                &lt;div id="gameFlow"&gt;

                &lt;/div&gt;
                &lt;!-- Player turn stuff goes here (changes depending on which phase, etc) --&gt;
                &lt;div id="playerActions"&gt;

                &lt;/div&gt;
                &lt;!-- Chat goes here (implement last) --&gt;
                &lt;div id="chatText"&gt;

                &lt;/div&gt;
                &lt;div class="clear"&gt;&lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;

    '''</span><span class="pln">

    </span><span class="kwd">else</span><span class="pun">:</span><span class="pln">
        </span><span class="kwd">return</span><span class="pln"> </span><span class="str">"Invalid page."</span><span class="pln">

run</span><span class="pun">(</span><span class="pln">host</span><span class="pun">=</span><span class="str">'localhost'</span><span class="pun">,</span><span class="pln"> port</span><span class="pun">=</span><span class="lit">8080</span><span class="pun">)</span></code></pre>

<hr>

<p>And here's my Populate.py (this is where my AJAX @route methods are stored):</p>

<pre class="default prettyprint prettyprinted" style=""><code><span class="pln">    </span><span class="str">"""
This module contains the bottle routs for AJAX population of the various parts
of the game page.
"""</span><span class="pln">

</span><span class="kwd">from</span><span class="pln"> bottle </span><span class="kwd">import</span><span class="pln"> route</span><span class="pun">,</span><span class="pln"> run</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">template</span><span class="pun">,</span><span class="pln"> static_file</span><span class="pun">,</span><span class="pln"> request
</span><span class="kwd">from</span><span class="pln"> </span><span class="typ">Main</span><span class="pln"> </span><span class="kwd">import</span><span class="pln"> </span><span class="pun">*</span><span class="pln">  </span><span class="com"># Everything in Main can now be directly called.</span><span class="pln">

globalBegin</span><span class="pun">()</span><span class="pln">

</span><span class="lit">@route</span><span class="pun">(</span><span class="str">'/AddToChat/:game/:player'</span><span class="pun">,</span><span class="pln"> method</span><span class="pun">=</span><span class="str">'POST'</span><span class="pun">)</span><span class="pln">
</span><span class="kwd">def</span><span class="pln"> </span><span class="typ">AddToChat</span><span class="pun">(</span><span class="pln">game</span><span class="pun">,</span><span class="pln"> player</span><span class="pun">):</span><span class="pln">
    theText </span><span class="pun">=</span><span class="pln"> request</span><span class="pun">.</span><span class="pln">POST</span><span class="pun">.</span><span class="kwd">get</span><span class="pun">(</span><span class="str">'theChatText'</span><span class="pun">,</span><span class="pln"> </span><span class="str">''</span><span class="pun">).</span><span class="pln">strip</span><span class="pun">()</span><span class="pln">
    game </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">int</span><span class="pun">(</span><span class="pln">game</span><span class="pun">)</span><span class="pln">
    player </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">int</span><span class="pun">(</span><span class="pln">player</span><span class="pun">)</span><span class="pln">
    listOfGames</span><span class="pun">[</span><span class="pln">game</span><span class="pun">].</span><span class="pln">listOfPlayers</span><span class="pun">[</span><span class="pln">player</span><span class="pun">].</span><span class="pln">addChat</span><span class="pun">(</span><span class="pln">theText</span><span class="pun">)</span><span class="pln">

</span><span class="lit">@route</span><span class="pun">(</span><span class="str">'/GenerateChat/:game'</span><span class="pun">)</span><span class="pln">
</span><span class="kwd">def</span><span class="pln"> </span><span class="typ">GenerateChat</span><span class="pun">(</span><span class="pln">game</span><span class="pun">):</span><span class="pln">
    chatText </span><span class="pun">=</span><span class="pln"> </span><span class="str">""</span><span class="pln">
    game </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">int</span><span class="pun">(</span><span class="pln">game</span><span class="pun">)</span><span class="pln">
    </span><span class="kwd">for</span><span class="pln"> line </span><span class="kwd">in</span><span class="pln"> listOfGames</span><span class="pun">[</span><span class="pln">game</span><span class="pun">].</span><span class="pln">chatList</span><span class="pun">:</span><span class="pln">
        chatText </span><span class="pun">+=</span><span class="pln"> </span><span class="str">'&lt;div class="chatLine"&gt;&lt;p&gt;'</span><span class="pln">
        chatText </span><span class="pun">+=</span><span class="pln"> line</span><span class="pun">.</span><span class="pln">player</span><span class="pun">.</span><span class="pln">name
        chatText </span><span class="pun">+=</span><span class="pln"> </span><span class="str">' &gt; &lt;/p&gt;&lt;p&gt;'</span><span class="pln">
        chatText </span><span class="pun">+=</span><span class="pln"> line</span><span class="pun">.</span><span class="pln">text
        chatText </span><span class="pun">+=</span><span class="pln"> </span><span class="str">'&lt;/p&gt;&lt;/div&gt;'</span><span class="pln">
    </span><span class="kwd">return</span><span class="pln"> chatText</span></code></pre>

<hr>

<p>The problem is, the 'chatForm' form isn't working as intended. <code>AddToChat()</code> seems to think that <code>request.POST.get('theChatText', '')</code> is a <code>NoneType</code> when I try to submit text.</p>

<p>So yeah, I'm stumped as to why it's doing this. As far as I can see, <code>'theChatText'</code> should be a valid key in the POST dict.</p>

<p>I'll also just state that all my core game logic works (even though it's pretty clear that isn't the problem here).</p>

<p>Any help is appreciated.</p>

    </div>
    <div class="post-taglist">
        <a href="http://stackoverflow.com/questions/tagged/python" class="post-tag" title="show questions tagged &#39;python&#39;" rel="tag">python</a> <a href="http://stackoverflow.com/questions/tagged/ajax" class="post-tag" title="show questions tagged &#39;ajax&#39;" rel="tag">ajax</a> <a href="http://stackoverflow.com/questions/tagged/post" class="post-tag" title="show questions tagged &#39;post&#39;" rel="tag">post</a> <a href="http://stackoverflow.com/questions/tagged/asynchronous" class="post-tag" title="show questions tagged &#39;asynchronous&#39;" rel="tag">asynchronous</a> <a href="http://stackoverflow.com/questions/tagged/bottle" class="post-tag" title="show questions tagged &#39;bottle&#39;" rel="tag">bottle</a> 
    </div>
    <table class="fw">
    <tbody><tr>
    <td class="vt">










<div class="post-menu"><a href="http://stackoverflow.com/q/13107535" title="short permalink to this question" class="short-link" id="link-post-13107535">share</a><span class="lsep">|</span><a href="http://stackoverflow.com/posts/13107535/edit" class="suggest-edit-post" title="">improve this question</a></div>        
    </td>
    <td align="right" class="post-signature">


    <div class="user-info user-hover">
        <div class="user-action-time">
                            <a href="http://stackoverflow.com/posts/13107535/revisions" title="show all edits to this post">edited <span title="2012-10-28 10:14:52Z" class="relativetime">Oct 28 '12 at 10:14</span></a>

        </div>
        <div class="user-gravatar32">
            <a href="http://stackoverflow.com/users/100297/martijn-pieters"><div class=""><img src="./ajax - Using asynchronous POST requests with Python's Bottle  - Stack Overflow_files/24780fb6df85a943c7aea0402c843737" alt="" width="32" height="32"></div></a>
        </div>
        <div class="user-details">
            <a href="http://stackoverflow.com/users/100297/martijn-pieters">Martijn Pieters</a><br>
            <span class="reputation-score" title="reputation score 130511" dir="ltr">131k</span><span title="14 gold badges"><span class="badge1"></span><span class="badgecount">14</span></span><span title="137 silver badges"><span class="badge2"></span><span class="badgecount">137</span></span><span title="239 bronze badges"><span class="badge3"></span><span class="badgecount">239</span></span>
        </div>
    </div>
    </td>
    <td class="post-signature owner">
        

    <div class="user-info ">
        <div class="user-action-time">
                                    asked <span title="2012-10-28 08:58:35Z" class="relativetime">Oct 28 '12 at 8:58</span>
        </div>
        <div class="user-gravatar32">
            <a href="http://stackoverflow.com/users/1342757/djentleman"><div class=""><img src="./ajax - Using asynchronous POST requests with Python's Bottle  - Stack Overflow_files/a4c6364bf2f8e68426a903e22aeabd82" alt="" width="32" height="32"></div></a>
        </div>
        <div class="user-details">
            <a href="http://stackoverflow.com/users/1342757/djentleman">Djentleman</a><br>
            <span class="reputation-score" title="reputation score" dir="ltr">343</span><span title="1 silver badge"><span class="badge2"></span><span class="badgecount">1</span></span><span title="16 bronze badges"><span class="badge3"></span><span class="badgecount">16</span></span>
        </div>
    </div>

    </td>
    </tr>
    </tbody></table>
</div>
</td>
        </tr>


<tr>
<td class="votecell"></td>
<td>
    <div id="comments-13107535" class="comments">
        <table>
        <tbody>
                    
    <tr id="comment-17818040" class="comment">
        <td></td>
        <td class="comment-text"><div><span class="comment-copy">Please don't add 'solved' to a question title; instead, mark the answer that helped you as accepted; this applies to self-answers too.</span> –&nbsp;<a href="http://stackoverflow.com/users/100297/martijn-pieters" title="130511 reputation" class="comment-user">Martijn Pieters</a> <span class="comment-date" dir="ltr"><a class="comment-link" href="http://stackoverflow.com/questions/13107535/using-asynchronous-post-requests-with-pythons-bottle#comment17818040_13107535"><span title="2012-10-28 10:15:31Z" class="relativetime-clean">Oct 28 '12 at 10:15</span></a></span></div></td>
    </tr>
            
    <tr id="comment-17818068" class="comment">
        <td></td>
        <td class="comment-text"><div><span class="comment-copy">Instead of <code>'''long string ''' + str(something) + ''' more string'''</code>, use <a href="http://docs.python.org/2/library/string.html#formatstrings" rel="nofollow">string formatting</a> to interpolate information into your output: <code>'''long string {something} more string'''.format(something=something)</code>.</span> –&nbsp;<a href="http://stackoverflow.com/users/100297/martijn-pieters" title="130511 reputation" class="comment-user">Martijn Pieters</a> <span class="comment-date" dir="ltr"><a class="comment-link" href="http://stackoverflow.com/questions/13107535/using-asynchronous-post-requests-with-pythons-bottle#comment17818068_13107535"><span title="2012-10-28 10:19:45Z" class="relativetime-clean">Oct 28 '12 at 10:19</span></a></span></div></td>
    </tr>
            
    <tr id="comment-17818303" class="comment">
        <td></td>
        <td class="comment-text"><div><span class="comment-copy">Will do in the future, and thanks for the tip :)</span> –&nbsp;<a href="http://stackoverflow.com/users/1342757/djentleman" title="343 reputation" class="comment-user owner">Djentleman</a> <span class="comment-date" dir="ltr"><a class="comment-link" href="http://stackoverflow.com/questions/13107535/using-asynchronous-post-requests-with-pythons-bottle#comment17818303_13107535"><span title="2012-10-28 10:44:13Z" class="relativetime-clean">Oct 28 '12 at 10:44</span></a></span></div></td>
    </tr>

        </tbody>
    
        </table>
    </div>
    
</td>
</tr>            </tbody></table>    
</div>


<div id="answers">

    <a name="tab-top"></a>
    <div id="answers-header">
        <div class="subheader answers-subheader">
            <h2>
                    1 Answer
            </h2>
            <div id="tabs">
                <a href="http://stackoverflow.com/questions/13107535/using-asynchronous-post-requests-with-pythons-bottle?answertab=active#tab-top" title="Answers with the latest activity first">active</a>
<a href="http://stackoverflow.com/questions/13107535/using-asynchronous-post-requests-with-pythons-bottle?answertab=oldest#tab-top" title="Answers in the order they were provided">oldest</a>
<a class="youarehere" href="http://stackoverflow.com/questions/13107535/using-asynchronous-post-requests-with-pythons-bottle?answertab=votes#tab-top" title="Answers with the highest score first">votes</a>

            </div>
        </div>    
    </div>    




  
<a name="13107820"></a>
<div id="answer-13107820" class="answer accepted-answer" data-answerid="13107820">
    <table>
        <tbody><tr>
            <td class="votecell">
                

<div class="vote">
    <input type="hidden" value="13107820">
    <a class="vote-up-off" title="This answer is useful">up vote</a>
    <span class="vote-count-post ">0</span>
    <a class="vote-down-off" title="This answer is not useful">down vote</a>
    

            <span class="vote-accepted-on load-accepted-answer-date" title="loading when this answer was accepted...">accepted</span>
</div>

            </td>
            


<td class="answercell">
    <div class="post-text"><p>Original jQuery function:</p>

<pre class="default prettyprint prettyprinted" style=""><code><span class="pln">$</span><span class="pun">(</span><span class="pln">document</span><span class="pun">).</span><span class="pln">ready</span><span class="pun">(</span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    $</span><span class="pun">(</span><span class="str">'#chatForm'</span><span class="pun">).</span><span class="pln">submit</span><span class="pun">(</span><span class="kwd">function</span><span class="pun">(</span><span class="pln">e</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
        $</span><span class="pun">.</span><span class="pln">ajax</span><span class="pun">({</span><span class="pln">
            type</span><span class="pun">:</span><span class="pln"> </span><span class="str">'POST'</span><span class="pun">,</span><span class="pln">
            url</span><span class="pun">:</span><span class="pln"> </span><span class="str">"/AddToChat/''' + str(game) + '''/''' + str(player) + '''"</span><span class="pun">,</span><span class="pln">
            success</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
                $</span><span class="pun">(</span><span class="str">'#chatInput'</span><span class="pun">).</span><span class="pln">val</span><span class="pun">(</span><span class="str">""</span><span class="pun">);</span><span class="pln">
            </span><span class="pun">}</span><span class="pln">
        </span><span class="pun">});</span><span class="pln">
        e</span><span class="pun">.</span><span class="pln">preventDefault</span><span class="pun">();</span><span class="pln">
    </span><span class="pun">});</span><span class="pln">
</span><span class="pun">});</span></code></pre>

<p><code>data: $(this).serialize(),</code> needed to be added, like so:</p>

<pre class="default prettyprint prettyprinted" style=""><code><span class="pln">$</span><span class="pun">(</span><span class="pln">document</span><span class="pun">).</span><span class="pln">ready</span><span class="pun">(</span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    $</span><span class="pun">(</span><span class="str">'#chatForm'</span><span class="pun">).</span><span class="pln">submit</span><span class="pun">(</span><span class="kwd">function</span><span class="pun">(</span><span class="pln">e</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
        $</span><span class="pun">.</span><span class="pln">ajax</span><span class="pun">({</span><span class="pln">
            type</span><span class="pun">:</span><span class="pln"> </span><span class="str">'POST'</span><span class="pun">,</span><span class="pln">
            url</span><span class="pun">:</span><span class="pln"> </span><span class="str">"/AddToChat/''' + str(game) + '''/''' + str(player) + '''"</span><span class="pun">,</span><span class="pln">
            data</span><span class="pun">:</span><span class="pln"> $</span><span class="pun">(</span><span class="kwd">this</span><span class="pun">).</span><span class="pln">serialize</span><span class="pun">(),</span><span class="pln">
            success</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
                $</span><span class="pun">(</span><span class="str">'#chatInput'</span><span class="pun">).</span><span class="pln">val</span><span class="pun">(</span><span class="str">""</span><span class="pun">);</span><span class="pln">
            </span><span class="pun">}</span><span class="pln">
        </span><span class="pun">});</span><span class="pln">
        e</span><span class="pun">.</span><span class="pln">preventDefault</span><span class="pun">();</span><span class="pln">
    </span><span class="pun">});</span><span class="pln">
</span><span class="pun">});</span></code></pre>

<p>Otherwise the server (or Bottle in this case) won't be able to read the submitted form.</p>
</div>
    <table class="fw">
    <tbody><tr>
    <td class="vt">










<div class="post-menu"><a href="http://stackoverflow.com/a/13107820" title="short permalink to this answer" class="short-link" id="link-post-13107820">share</a><span class="lsep">|</span><a href="http://stackoverflow.com/posts/13107820/edit" class="suggest-edit-post" title="">improve this answer</a></div>                    </td>
            


    <td align="right" class="post-signature owner">   
       

    

    <div class="user-info ">
        <div class="user-action-time">
                                        answered <span title="2012-10-28 09:52:08Z" class="relativetime">Oct 28 '12 at 9:52</span>
        </div>
        <div class="user-gravatar32">
            <a href="http://stackoverflow.com/users/1342757/djentleman"><div class=""><img src="./ajax - Using asynchronous POST requests with Python's Bottle  - Stack Overflow_files/a4c6364bf2f8e68426a903e22aeabd82" alt="" width="32" height="32"></div></a>
        </div>
        <div class="user-details">
            <a href="http://stackoverflow.com/users/1342757/djentleman">Djentleman</a><br>
            <span class="reputation-score" title="reputation score" dir="ltr">343</span><span title="1 silver badge"><span class="badge2"></span><span class="badgecount">1</span></span><span title="16 bronze badges"><span class="badge3"></span><span class="badgecount">16</span></span>
        </div>
    </div>

    </td>
    </tr>
    </tbody></table>
</td>
        </tr>



<tr>
<td class="votecell"></td>
<td>
    <div id="comments-13107820" class="comments dno">
        <table>
        <tbody>
        
            <tr><td></td><td></td></tr>
        
        </tbody>
    
        </table>
    </div>
    
</td>
</tr>
    </tbody></table>
</div>
    <a name="new-answer"></a>
    <form id="post-form" action="http://stackoverflow.com/questions/13107535/answer/submit" method="post" class="post-form">
        <input type="hidden" id="post-id" value="13107535">
        <h2 class="space">Your Answer</h2>



    
<script type="text/javascript">
    StackExchange.ready(function() {
        initTagRenderer("".split(" "), "".split(" "));
         
        prepareEditor({
            heartbeatType: 'answer',
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
        });
        

    });  
</script>


<div id="post-editor" class="post-editor">

    <div style="position: relative;">     
        <div class="wmd-container">
            <div id="wmd-button-bar" class="wmd-button-bar"><ul id="wmd-button-row" class="wmd-button-row"><li id="wmd-bold-button" class="wmd-button" style="left: 0px;"><span style="background-position: 0px -20px;"></span></li><li id="wmd-italic-button" class="wmd-button" style="left: 25px;"><span style="background-position: -20px -20px;"></span></li><li id="wmd-spacer1" class="wmd-spacer" style="left: 50px;"><span style="background-position: -40px -20px;"></span></li><li id="wmd-link-button" class="wmd-button" style="left: 75px;"><span style="background-position: -40px -20px;"></span></li><li id="wmd-quote-button" class="wmd-button" style="left: 100px;"><span style="background-position: -60px -20px;"></span></li><li id="wmd-code-button" class="wmd-button" style="left: 125px;"><span style="background-position: -80px -20px;"></span></li><li id="wmd-image-button" class="wmd-button" style="left: 150px;"><span style="background-position: -100px -20px;"></span></li><li id="wmd-spacer2" class="wmd-spacer" style="left: 175px;"><span style="background-position: -120px -20px;"></span></li><li id="wmd-olist-button" class="wmd-button" style="left: 200px;"><span style="background-position: -120px -20px;"></span></li><li id="wmd-ulist-button" class="wmd-button" style="left: 225px;"><span style="background-position: -140px -20px;"></span></li><li id="wmd-heading-button" class="wmd-button" style="left: 250px;"><span style="background-position: -160px -20px;"></span></li><li id="wmd-hr-button" class="wmd-button" style="left: 275px;"><span style="background-position: -180px -20px;"></span></li><li id="wmd-spacer3" class="wmd-spacer" style="left: 300px;"><span style="background-position: -200px -20px;"></span></li><li id="wmd-undo-button" class="wmd-button" style="left: 325px;"><span style="background-position: -200px -20px;"></span></li><li id="wmd-redo-button" class="wmd-button" style="left: 350px;"><span style="background-position: -220px -20px;"></span></li></ul></div>
            <textarea id="wmd-input" class="wmd-input" name="post-text" cols="92" rows="15" tabindex="101" data-min-length=""></textarea>
        </div>
    </div>

    <div class="fl" style="margin-top: 8px; height:24px;">&nbsp;</div>
    <div id="draft-saved" class="draft-saved community-option fl" style="margin-top: 8px; height:24px; display:none;">draft saved</div>

    <div id="draft-discarded" class="draft-discarded community-option fl" style="margin-top: 8px; height:24px; display:none;">draft discarded</div>



    <div id="wmd-preview" class="wmd-preview"></div>
    <div></div>
    <div class="edit-block">
        <input id="fkey" name="fkey" type="hidden" value="2d0aec7595cc73e90ef39640b48e41c2">
        <input id="author" name="author" type="text">
    </div>
</div>
        <div style="position: relative;"> 
            <div class="form-item new-post-login">
        
                <div class="new-login-form">
                    <div class="new-login-left">
                        <h3>Sign up or <a id="login-link" href="http://stackoverflow.com/users/login?returnurl=%2fquestions%2f13107535%2fusing-asynchronous-post-requests-with-pythons-bottle%23new-answer">log in</a></h3>
                        <script type="text/javascript">
                            StackExchange.ready(function () {
                                StackExchange.helpers.onClickDraftSave('#login-link');
                            });
                        </script>
                        <div class="preferred-login google-login">
                            <p><span class="icon"></span><span>Sign up using Google</span></p>
                        </div>
                        <div class="preferred-login facebook-login">
                            <p><span class="icon"></span><span>Sign up using Facebook</span></p>
                        </div>
                        <div class="preferred-login stackexchange-login">
                            <p><span class="icon"></span><span>Sign up using Stack Exchange</span></p>
                        </div>
                    </div>
                    <input type="hidden" name="manual-openid" class="manual-openid">
                    <input type="hidden" name="use-facebook" class="use-facebook" value="false">
                    <input type="button" class="submit-openid" value="Submit" style="display:none">
                    <div class="new-login-right">
                                <h3>Post as a guest</h3>
    <div class="form-item">
        <table>
        <tbody><tr>
                    <script type="text/javascript">
                StackExchange.ready(function () {
                    StackExchange.helpers.bindHelpOverlayEvents($('.vm input'));
                });
            </script>
            <td class="vm">
                <div>
                    <label for="display-name">Name</label>
                    <input id="display-name" name="display-name" type="text" size="30" maxlength="30" value="" tabindex="105">
                </div>
                <div>
                    <label for="m-address">Email</label>
                    <input id="m-address" name="m-address" type="text" size="30" maxlength="100" value="" tabindex="106">
                    <span class="edit-field-overlay">required, but not shown</span>
                </div>
            </td>
        </tr>
        </tbody></table>
    </div>

                    </div>
                </div>
            </div>
            <script type="text/javascript">
                StackExchange.ready(
                    function () {
                        StackExchange.openid.initPostLogin('.new-post-login', '%2fquestions%2f13107535%2fusing-asynchronous-post-requests-with-pythons-bottle%23new-answer');
                    }
                );
            </script>
            <noscript>
                        &lt;h3&gt;Post as a guest&lt;/h3&gt;
    &lt;div class="form-item"&gt;
        &lt;table&gt;
        &lt;tr&gt;
                    &lt;script type="text/javascript"&gt;
                StackExchange.ready(function () {
                    StackExchange.helpers.bindHelpOverlayEvents($('.vm input'));
                });
            &lt;/script&gt;
            &lt;td class="vm"&gt;
                &lt;div&gt;
                    &lt;label for="display-name"&gt;Name&lt;/label&gt;
                    &lt;input id="display-name" name="display-name" type="text" size="30" maxlength="30" value="" tabindex="105"&gt;
                &lt;/div&gt;
                &lt;div&gt;
                    &lt;label for="m-address"&gt;Email&lt;/label&gt;
                    &lt;input id="m-address" name="m-address" type="text" size="30" maxlength="100" value="" tabindex="106"&gt;
                    &lt;span class="edit-field-overlay"&gt;required, but not shown&lt;/span&gt;
                &lt;/div&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;/table&gt;
    &lt;/div&gt;

            </noscript>
        </div>
           
            <div class="form-submit cbt">
            <input id="submit-button" type="submit" value="Post Your Answer" tabindex="110">
            <a href="http://stackoverflow.com/questions/13107535/using-asynchronous-post-requests-with-pythons-bottle#" class="discard-answer dno">discard</a>
    <p class="privacy-policy-agreement">
        By posting your answer, you agree to the 
        <a href="http://stackexchange.com/legal/privacy-policy" target="_blank">privacy policy</a> and 
        <a href="http://stackexchange.com/legal/terms-of-service" target="_blank">terms of service</a>.
    </p>
    <input type="hidden" name="legalLinksShown" value="1">
        </div>
    </form>



        <h2 class="bottom-notice">
                Not the answer you're looking for? 
            Browse other questions tagged <a href="http://stackoverflow.com/questions/tagged/python" class="post-tag" title="show questions tagged &#39;python&#39;" rel="tag">python</a> <a href="http://stackoverflow.com/questions/tagged/ajax" class="post-tag" title="show questions tagged &#39;ajax&#39;" rel="tag">ajax</a> <a href="http://stackoverflow.com/questions/tagged/post" class="post-tag" title="show questions tagged &#39;post&#39;" rel="tag">post</a> <a href="http://stackoverflow.com/questions/tagged/asynchronous" class="post-tag" title="show questions tagged &#39;asynchronous&#39;" rel="tag">asynchronous</a> <a href="http://stackoverflow.com/questions/tagged/bottle" class="post-tag" title="show questions tagged &#39;bottle&#39;" rel="tag">bottle</a> 
                or <a href="http://stackoverflow.com/questions/ask">ask your own question</a>.
        </h2>
</div>
</div>
<div id="sidebar" class="show-votes">
        <div class="module question-stats">
        <p class="label-key">tagged</p>
        <div class="tagged"><a href="http://stackoverflow.com/questions/tagged/python" class="post-tag" title="show questions tagged &#39;python&#39;" rel="tag">python</a>&nbsp;<span class="item-multiplier"><span class="item-multiplier-x">×</span>&nbsp;<span class="item-multiplier-count">199806</span></span><br>
<a href="http://stackoverflow.com/questions/tagged/ajax" class="post-tag" title="show questions tagged &#39;ajax&#39;" rel="tag">ajax</a>&nbsp;<span class="item-multiplier"><span class="item-multiplier-x">×</span>&nbsp;<span class="item-multiplier-count">65111</span></span><br>
<a href="http://stackoverflow.com/questions/tagged/post" class="post-tag" title="show questions tagged &#39;post&#39;" rel="tag">post</a>&nbsp;<span class="item-multiplier"><span class="item-multiplier-x">×</span>&nbsp;<span class="item-multiplier-count">11583</span></span><br>
<a href="http://stackoverflow.com/questions/tagged/asynchronous" class="post-tag" title="show questions tagged &#39;asynchronous&#39;" rel="tag">asynchronous</a>&nbsp;<span class="item-multiplier"><span class="item-multiplier-x">×</span>&nbsp;<span class="item-multiplier-count">8126</span></span><br>
<a href="http://stackoverflow.com/questions/tagged/bottle" class="post-tag" title="show questions tagged &#39;bottle&#39;" rel="tag">bottle</a>&nbsp;<span class="item-multiplier"><span class="item-multiplier-x">×</span>&nbsp;<span class="item-multiplier-count">360</span></span><br>
</div>
        <table id="qinfo">
            <tbody><tr>
                <td><p class="label-key">asked</p></td>
                <td style="padding-left:10px"><p class="label-key" title="2012-10-28 08:58:35Z"><b>8 months ago</b></p></td>
            </tr>
            <tr>
                <td><p class="label-key">viewed</p></td>

                <td style="padding-left:10px">
                    <p class="label-key">
                        <b>584 times</b>
                    </p>
                </td>
            </tr>
            <tr>
                <td><p class="label-key">active</p></td>
                <td style="padding-left:10px"><p class="label-key"><b><a href="http://stackoverflow.com/questions/13107535/using-asynchronous-post-requests-with-pythons-bottle?lastactivity" class="lastactivity-link" title="2012-10-28 10:14:52Z">8 months ago</a></b></p></td>
            </tr>
        </tbody></table>
    </div>
        
                    <script type="text/javascript">
                    var scriptSrc = "http://engine.adzerk.net/z/8277/adzerk1_2_4_43,adzerk2_2_17_45?keywords=python,ajax,post,asynchronous,bottle";
                    if (document.referrer) {
                        if (/\?/.test(scriptSrc))
                            scriptSrc += "&";
                        else
                            scriptSrc += "?";
                        scriptSrc += "xReferrer=" + document.referrer;
                    }
                    StackExchange.ready(function() {
                        var z = document.createElement("script");
                        z.type = "text/javascript";
                        z.async = "true";
                        z.src = scriptSrc;
                        var s = document.getElementsByTagName("script")[0];
                        s.parentNode.insertBefore(z, s);
                    });
                </script>
            
    <div id="hireme"> <a href="http://careers.stackoverflow.com/jobs?a=24" class="top" target="_blank"></a> <ul class="jobs"> <li> <a href="http://careers.stackoverflow.com/jobs/36003/net-developers-entry-level-and-mid-level-greenshades-software?a=GxiP6es" target="_blank" title=".NET Developers (Entry Level and Mid-Level) at Greenshades Software. Click to learn more."> .NET Developers (Entry Level and Mid-Level)<br> <span class="company">Greenshades Software</span> <span class="location">Jacksonville, FL</span> </a> </li> <li> <a href="http://careers.stackoverflow.com/jobs/35693/senior-network-voice-engineer-job-id-215934-continental-ag?a=GaAUH4s" target="_blank" title="Senior Network &amp; Voice Engineer (Job ID: 215934) at Continental AG. Click to learn more."> Senior Network &amp; Voice Engineer (Job ID: 215934)<br> <span class="company">Continental AG</span> <span class="location">Charlotte, NC</span> </a> </li> <li> <a href="http://careers.stackoverflow.com/jobs/35474/devops-engineer-remote-end-point-corporation?a=FUyifio" target="_blank" title="DevOps engineer - remote at End Point. Click to learn more."> DevOps engineer - remote<br> <span class="company">End Point</span> <span class="location">New York, NY / remote</span> </a> </li> <li> <a href="http://careers.stackoverflow.com/jobs/36198/full-stack-software-engineer-weddington-way?a=GLArA3K" target="_blank" title="Full Stack Software Engineer at Weddington Way. Click to learn more."> Full Stack Software Engineer<br> <span class="company">Weddington Way</span> <span class="location">San Francisco, CA</span> </a> </li> <li> <a href="http://careers.stackoverflow.com/jobs/34256/android-ui-engineer-meetup?a=Etkzqr6" target="_blank" title="Android UI Engineer at Meetup. Click to learn more."> Android UI Engineer<br> <span class="company">Meetup</span> <span class="location">New York, NY</span> </a> </li> <li> <a href="http://careers.stackoverflow.com/jobs/34305/software-engineer-techsmith-corporation?a=EwV6WpG" target="_blank" title="Software Engineer at TechSmith. Click to learn more."> Software Engineer<br> <span class="company">TechSmith</span> <span class="location">Okemos, MI</span> </a> </li> </ul> <img alt="" class="impression" src="./ajax - Using asynchronous POST requests with Python's Bottle  - Stack Overflow_files/GxiP6es-GaAUH4s-FUyifio-GLArA3K-Etkzqr6-EwV6WpG-24" style="display:none"></div>



      
    
    <div class="module sidebar-related">
        <h4 id="h-related">Related</h4>
        <div class="related" data-tracker="rq=1">
            <div class="spacer">
<a href="http://stackoverflow.com/q/166221?rq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes large">654</div>
</a>
<a href="http://stackoverflow.com/questions/166221/how-can-i-upload-files-asynchronously-with-jquery?rq=1" class="question-hyperlink">How can I upload files asynchronously with jQuery?</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/4941145?rq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes answered-accepted large">110</div>
</a>
<a href="http://stackoverflow.com/questions/4941145/python-flask-vs-bottle?rq=1" class="question-hyperlink">Python Flask vs Bottle</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/7527413?rq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes answered-accepted default">2</div>
</a>
<a href="http://stackoverflow.com/questions/7527413/use-python-bottle-server-to-receive-fileentity-of-a-post-request-from-android?rq=1" class="question-hyperlink">Use Python bottle server to receive FileEntity of a POST request from Android</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/8116821?rq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes default">0</div>
</a>
<a href="http://stackoverflow.com/questions/8116821/post-request-in-ajax-dont-work-asynchronous?rq=1" class="question-hyperlink">POST request in AJAX dont work asynchronous</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/9166293?rq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes answered-accepted default">6</div>
</a>
<a href="http://stackoverflow.com/questions/9166293/ajax-submission-form-using-bottle-python?rq=1" class="question-hyperlink">AJAX Submission Form using Bottle (Python)</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/10563998?rq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes answered-accepted default">0</div>
</a>
<a href="http://stackoverflow.com/questions/10563998/extjs-ajax-response-with-python-bottle?rq=1" class="question-hyperlink">extjs ajax response with python bottle</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/13098494?rq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes answered-accepted default">0</div>
</a>
<a href="http://stackoverflow.com/questions/13098494/using-jquery-ajax-with-pythons-bottle?rq=1" class="question-hyperlink">Using jQuery AJAX with Python's Bottle</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/13115324?rq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes answered-accepted default">1</div>
</a>
<a href="http://stackoverflow.com/questions/13115324/pythons-bottle-long-polling?rq=1" class="question-hyperlink">Python's Bottle &amp; Long-Polling?</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/13173649?rq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes answered-accepted default">0</div>
</a>
<a href="http://stackoverflow.com/questions/13173649/checking-which-submit-post-button-is-pressed-with-pythons-bottle?rq=1" class="question-hyperlink">Checking which “submit” POST button is pressed with Python's Bottle</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/16395206?rq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes answered-accepted default">0</div>
</a>
<a href="http://stackoverflow.com/questions/16395206/posting-to-bottle-server-how-do-i-get-the-request-data?rq=1" class="question-hyperlink">Posting to Bottle server. How do I get the request data?</a>
</div>

        </div>
    </div>
</div>

<div id="feed-link">
    <div id="feed-link-text"><a href="http://stackoverflow.com/feeds/question/13107535" title="feed of this question and its answers"><span class="feed-icon"></span>question feed</a></div>
</div>
<script type="text/javascript">
StackExchange.ready(function(){$.get('/posts/13107535/ivc/8ec7');});
</script>
<noscript>
    &lt;div&gt;&lt;img src="/posts/13107535/ivc/8ec7" class="dno" alt="" width="0" height="0"&gt;&lt;/div&gt;
</noscript><div style="display:none" id="prettify-lang">default</div></div>


        </div>
    </div>
    <div id="footer" class="categories">
        <div class="footerwrap">
            <div id="footer-menu">
                <div class="top-footer-links">
                        <a href="http://stackoverflow.com/about">about</a>
                    <a href="http://stackoverflow.com/help">help</a>
                        <a href="http://stackoverflow.com/help/badges">badges</a>
                    <a href="http://blog.stackexchange.com/?blb=1">blog</a>
                        <a href="http://chat.stackoverflow.com/">chat</a>
                    <a href="http://data.stackexchange.com/">data</a>
                    <a href="http://stackexchange.com/legal">legal</a>
                    <a href="http://stackexchange.com/legal/privacy-policy">privacy policy</a>
                    <a href="http://stackexchange.com/about/hiring">jobs</a>
                    <a href="http://engine.adzerk.net/redirect/0/2776/2751/0/4de3c60f719c4dfcb1a57531c7050090/0">advertising info</a>

                    <a onclick="StackExchange.switchMobile(&quot;on&quot;, &quot;/questions/13107535/using-asynchronous-post-requests-with-pythons-bottle&quot;)">mobile</a>
                    <b><a href="http://stackoverflow.com/contact">contact us</a></b>
                        <b><a href="http://meta.stackoverflow.com/">feedback</a></b>
                </div>
                <div id="footer-sites">
                <table>
    <tbody><tr>
            <th colspan="3">
                Technology
            </th>
            <th>
                Life / Arts
            </th>
            <th>
                Culture / Recreation
            </th>
            <th>
                Science
            </th>
            <th>
                Other
            </th>
    </tr>
    <tr>
            <td>
                <ol>
                        <li><a href="http://stackoverflow.com/" title="professional and enthusiast programmers">Stack Overflow</a></li>
                        <li><a href="http://serverfault.com/" title="professional system and network administrators">Server Fault</a></li>
                        <li><a href="http://superuser.com/" title="computer enthusiasts and power users">Super User</a></li>
                        <li><a href="http://webapps.stackexchange.com/" title="power users of web applications">Web Applications</a></li>
                        <li><a href="http://askubuntu.com/" title="Ubuntu users and developers">Ask Ubuntu</a></li>
                        <li><a href="http://webmasters.stackexchange.com/" title="pro webmasters">Webmasters</a></li>
                        <li><a href="http://gamedev.stackexchange.com/" title="professional and independent game developers">Game Development</a></li>
                        <li><a href="http://tex.stackexchange.com/" title="users of TeX, LaTeX, ConTeXt, and related typesetting systems">TeX - LaTeX</a></li>
                            </ol></td><td><ol>
                        <li><a href="http://programmers.stackexchange.com/" title="professional programmers interested in conceptual questions about software development">Programmers</a></li>
                        <li><a href="http://unix.stackexchange.com/" title="users of Linux, FreeBSD and other Un*x-like operating systems.">Unix &amp; Linux</a></li>
                        <li><a href="http://apple.stackexchange.com/" title="power users of Apple hardware and software">Ask Different (Apple)</a></li>
                        <li><a href="http://wordpress.stackexchange.com/" title="WordPress developers and administrators">WordPress Answers</a></li>
                        <li><a href="http://gis.stackexchange.com/" title="cartographers, geographers and GIS professionals">Geographic Information Systems</a></li>
                        <li><a href="http://electronics.stackexchange.com/" title="electronics and electrical engineering professionals, students, and enthusiasts">Electrical Engineering</a></li>
                        <li><a href="http://android.stackexchange.com/" title="enthusiasts and power users of the Android operating system">Android Enthusiasts</a></li>
                        <li><a href="http://security.stackexchange.com/" title="IT security professionals">IT Security</a></li>
                            </ol></td><td><ol>
                        <li><a href="http://dba.stackexchange.com/" title="database professionals who wish to improve their database skills and learn from others in the community">Database Administrators</a></li>
                        <li><a href="http://drupal.stackexchange.com/" title="Drupal developers and administrators">Drupal Answers</a></li>
                        <li><a href="http://sharepoint.stackexchange.com/" title="SharePoint enthusiasts">SharePoint</a></li>
                        <li><a href="http://ux.stackexchange.com/" title="user experience researchers and experts">User Experience</a></li>
                        <li><a href="http://mathematica.stackexchange.com/" title="users of Mathematica">Mathematica</a></li>
                    
                        <li>
                            <a href="http://stackexchange.com/sites#technology" class="more">
                                more (13)
                            </a>
                        </li>
                </ol>
            </td>
            <td>
                <ol>
                        <li><a href="http://photo.stackexchange.com/" title="professional, enthusiast and amateur photographers">Photography</a></li>
                        <li><a href="http://scifi.stackexchange.com/" title="science fiction and fantasy enthusiasts">Science Fiction &amp; Fantasy</a></li>
                        <li><a href="http://cooking.stackexchange.com/" title="professional and amateur chefs">Seasoned Advice (cooking)</a></li>
                        <li><a href="http://diy.stackexchange.com/" title="contractors and serious DIYers">Home Improvement</a></li>
                    
                        <li>
                            <a href="http://stackexchange.com/sites#lifearts" class="more">
                                more (13)
                            </a>
                        </li>
                </ol>
            </td>
            <td>
                <ol>
                        <li><a href="http://english.stackexchange.com/" title="linguists, etymologists, and serious English language enthusiasts">English Language &amp; Usage</a></li>
                        <li><a href="http://skeptics.stackexchange.com/" title="scientific skepticism">Skeptics</a></li>
                        <li><a href="http://judaism.stackexchange.com/" title="those who base their lives on Jewish law and tradition and anyone interested in learning more">Mi Yodeya (Judaism)</a></li>
                        <li><a href="http://travel.stackexchange.com/" title="road warriors and seasoned travelers">Travel</a></li>
                        <li><a href="http://christianity.stackexchange.com/" title="committed Christians, experts in Christianity and those interested in learning more">Christianity</a></li>
                        <li><a href="http://gaming.stackexchange.com/" title="passionate videogamers on all platforms">Arqade (gaming)</a></li>
                        <li><a href="http://bicycles.stackexchange.com/" title="people who build and repair bicycles, people who train cycling, or commute on bicycles">Bicycles</a></li>
                        <li><a href="http://rpg.stackexchange.com/" title="gamemasters and players of tabletop, paper-and-pencil role-playing games">Role-playing Games</a></li>
                    
                        <li>
                            <a href="http://stackexchange.com/sites#culturerecreation" class="more">
                                more (21)
                            </a>
                        </li>
                </ol>
            </td>
            <td>
                <ol>
                        <li><a href="http://mathoverflow.net/" title="mathematicians">MathOverflow</a></li>
                        <li><a href="http://math.stackexchange.com/" title="people studying math at any level and professionals in related fields">Mathematics</a></li>
                        <li><a href="http://stats.stackexchange.com/" title="statisticians, data analysts, data miners and data visualization experts">Cross Validated (stats)</a></li>
                        <li><a href="http://cstheory.stackexchange.com/" title="theoretical computer scientists and researchers in related fields">Theoretical Computer Science</a></li>
                        <li><a href="http://physics.stackexchange.com/" title="active researchers, academics and students of physics">Physics</a></li>
                    
                        <li>
                            <a href="http://stackexchange.com/sites#science" class="more">
                                more (7)
                            </a>
                        </li>
                </ol>
            </td>
            <td>
                <ol>
                        <li><a href="http://stackapps.com/" title="apps, scripts, and development with the Stack Exchange API">Stack Apps</a></li>
                        <li><a href="http://meta.stackoverflow.com/" title="meta-discussion of the Stack Exchange family of Q&amp;A websites">Meta Stack Overflow</a></li>
                        <li><a href="http://area51.stackexchange.com/" title="proposing new sites in the Stack Exchange network">Area 51</a></li>
                        <li><a href="http://careers.stackoverflow.com/">Stack Overflow Careers</a></li>
                    
                </ol>
            </td>
    </tr>
</tbody></table>
                </div>
            </div>

            <div id="copyright">
                site design / logo © 2013 stack exchange inc; 
                user contributions licensed under <a href="http://creativecommons.org/licenses/by-sa/3.0/" rel="license">cc-wiki</a> 
                with <a href="http://blog.stackoverflow.com/2009/06/attribution-required/" rel="license">attribution required</a>
            </div>
            <div id="footer-flair">
                <a href="http://creativecommons.org/licenses/by-sa/3.0/" class="cc-wiki-link"></a>
            </div>
            <div id="svnrev">
                rev 2013.6.28.789
            </div>
            
        </div>
    </div>
    <noscript>
        &lt;div id="noscript-warning"&gt;Stack Overflow works best with JavaScript enabled&lt;img src="http://pixel.quantserve.com/pixel/p-c1rF4kxgLUzNc.gif" alt="" class="dno"&gt;&lt;/div&gt;
    </noscript>
    <script type="text/javascript">var _gaq=_gaq||[];_gaq.push(['_setAccount','UA-5620270-1']);
        _gaq.push(['_setCustomVar', 1, 'tags', '|python|ajax|post|asynchronous|bottle|']); 
_gaq.push(['_trackPageview']);
    var _qevents = _qevents || [];
    (function(){
        var s=document.getElementsByTagName('script')[0];
        var ga=document.createElement('script');
        ga.type='text/javascript';
        ga.async=true;
        ga.src='http://www.google-analytics.com/ga.js';
        s.parentNode.insertBefore(ga,s);
        var sc=document.createElement('script');
        sc.type='text/javascript';
        sc.async=true;
        sc.src='http://edge.quantserve.com/quant.js'; 
        s.parentNode.insertBefore(sc,s);
    })();
    </script>
    <script type="text/javascript">
        _qevents.push({ qacct: "p-c1rF4kxgLUzNc" });
    </script>        
    

</body></html>